package com.appsl.digitalparking;

import com.appsl.manager.Redirection;
import com.appsl.objects.Lugar;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;

public class MainAppView extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main_app_view);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main_app_view, menu);
		return true;
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if ((keyCode == KeyEvent.KEYCODE_BACK)) 
	    { //Back key pressed
	    	Redirection.goToLogin(this);
	        return true;
	    }
	    return super.onKeyDown(keyCode, event);
	}
	
	public void goToFavs(View view)
	{
		Redirection.goToFavs(this);
	}
	
	public void goToMap(View view)
	{
		//Lugar tmp = new Lugar(0, "Jockey Plaza", "-12.084394", "-76.978436", "Av. Javier Prado 5050");
		//Intent intent = new Intent(this, Map.class);
		//intent.putExtra("locName", tmp.getName());
		//startActivity(intent);
		Redirection.goToMap(this);
	}
}
